<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
 
<h:head>
 
<h:outputScript name="jsf.js" library="javax.faces"/>
 
</h:head>
 
<body>
 
<h:form>
 
<h:selectOneMenu value="#{bean.country_id}" id="countries">
        <f:selectItem itemLabel="-- Select a Country -- " itemValue="0"/>  
        <f:selectItems value="#{bean.countries}" var="country" itemValue="#{country.id}" itemLabel="#{country.name}"/>
        <f:ajax event="change"  render="cities" />
</h:selectOneMenu>  
 
 <h:selectOneMenu value="#{bean.city_id}" id="cities">
        <f:selectItem itemLabel="-- Select a City1 -- " itemValue="0"/>    
        <f:selectItems value="#{bean.cities}" var="city" itemValue="#{city.id}" itemLabel="#{city.name}"/>
 </h:selectOneMenu>
 
<h:commandButton action="#{bean.save}"  value="Save"/>
 
</h:form>
 
</body>
 
</html>
